package cn.b.sky.user.filter;

import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Map;

public class ProxyServletConfig implements ServletConfig {

  private String servletName;

  private final ServletContext servletContext;

  private Map<String, String> map = Collections.emptyMap();

  public ProxyServletConfig(ServletContext servletContext) {
    this.servletContext = servletContext;
  }

  @Override
  public String getServletName() {
    return this.servletName;
  }

  @Override
  public ServletContext getServletContext() {
    return this.servletContext;
  }

  @Override
  public String getInitParameter(String name) {
    return this.map.get(name);
  }

  @Override
  public Enumeration<String> getInitParameterNames() {
    return Collections.enumeration(this.map.keySet());
  }

  public void setServletName(String servletName) {
    this.servletName = servletName;
  }

  public void setMap(Map<String, String> map) {
    this.map = map;
  }
}
